package com.complex.spring.mvc.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class MyServlet extends HttpServlet {

	// 需要serialVersionUID
	private static final long serialVersionUID = -1687429430204510251L;

	public void init() throws ServletException
    {
		System.out.println("init");
    } 
	
	public void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		System.out.println("service");
		request.setAttribute("test", "测试参数传递");
		HttpSession session = request.getSession();
		session.setMaxInactiveInterval(10);
		//request.getRequestDispatcher("jsp/myservlet.jsp").forward(request, response);
	}
    public void destroy()
    {
    	System.out.println("destroy");
    }

}
